package exer;

/**
 * @author tongchen
 * @create 2023-01-17 17:57
 */
public class TimerExer {
    public static void main(String[] args) throws InterruptedException {
        //加入任务
        MyTimer myTimer = new MyTimer();
        myTimer.schedule(new MyTask(()->{
            System.out.println("任务1");
        },0));
        myTimer.schedule(new MyTask(()->{
            System.out.println("任务2");
        },0));
        myTimer.schedule(new MyTask(()->{
            System.out.println("任务3");
        },3000));
        myTimer.schedule(new MyTask(()->{
            System.out.println("任务4");
        },4000));
        myTimer.schedule(new MyTask(()->{
            System.out.println("任务5");
        },5000));
    }
}
